package com.atguigu.gmall.feign.ware;

import com.atguigu.gmall.feign.ware.fallback.WareFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Import;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author lfy
 * @Description
 * @create 2022-10-21 10:55
 * <p>
 * 给哪里发请求，默认是用名字作为微服务名去注册中心要服务器ip
 * url： 直接明确告诉feign给哪个路径发请求
 */
@Import(WareFeignClientFallBack.class)
@FeignClient(value = "ware-manage", url = "http://localhost:9001",
        fallback = WareFeignClientFallBack.class)
public interface WareFeignClient {

    /**
     * 兜底数据
     * 查询是否有库存
     * @param skuId
     * @param num
     * @return
     */
    @GetMapping("/hasStock")
    String hasStock(@RequestParam("skuId") Long skuId,
                    @RequestParam("num") Integer num);
}
